import { connect } from 'react-redux';
import { activeMenus, fetchTvs } from '../../actions';
import CustomNav from '../../components/CustomNav';

const mapStateToProps = (state) => {
  const { activeMenu, navs } = state;
  return {
    activeMenu,
    navs
  }
}

const mapDispatchToProps = (dispatch) => {
  return {
    onSwitchMenu: (id, title) => {
      dispatch(activeMenus(id))
      dispatch(fetchTvs({ menu: title }))
    }
  }
}

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(CustomNav)

